<?php

namespace App\Exception;

use Exception;
use Psr\Log\LogLevel;

class AppReturnException extends Exception
{
    protected  $message = '系统异常.';

    protected string $logLevel = LogLevel::INFO; // 默认日志级别为 INFO

    public function getLogLevel(): string
    {
        return $this->logLevel;
    }

    public function setLogLevel(string $logLevel): self
    {
        $this->logLevel = $logLevel;
        return $this;
    }

    public function __construct($message = null)
    {
        if ($message) {
            $this->message = $message;
        }

        parent::__construct($this->message);
    }
}